import App from './App'
import USER_AVATOR_URL from '@/common/common.js'
Vue.prototype.$USER_AVATOR_URL = USER_AVATOR_URL

// #ifndef VUE3
import Vue from 'vue'
import uView from "uview-ui";
Vue.use(uView);

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
    ...App
})
app.$mount()

uni.addInterceptor('request', {
	success(res) {
		console.log(res)
		// uni.setStorageSync("isLogin", 'no')
		// let isLogin = uni.getStorageSync('isLogin')
		if (res.data.code == 401){
			uni.setStorageSync("isLogin", "no")
			uni.showModal({
				title: '温馨提示',
				content: '授权微信登录后才能正常使用小程序功能',
				success(res) {
					if(res.confirm == true){
						uni.switchTab({
							url: '/pages/personal/personal'
						})
					}
				}
			})
		}
	}
})

// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app	
  }
}
// #endif